Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
irregular-plurals
Advanced tools
The irregular-plurals npm package is designed to provide a simple way to handle irregular plural forms of words in English. It is particularly useful for applications that need to dynamically generate text that conforms to grammatical rules.
Get the plural form of an irregular noun
This feature allows you to retrieve the plural form of an irregular noun. You simply pass the singular form of the noun to the `get` method, and it returns the corresponding plural form.
const irregularPlurals = require('irregular-plurals');
console.log(irregularPlurals.get('mouse')); // Outputs: 'mice'
The pluralize package is similar to irregular-plurals but offers more comprehensive functionality. It not only handles irregular plurals but also correctly pluralizes regular nouns and can revert plurals to their singular form. This makes it more versatile for applications that deal with a broader range of vocabulary.
Inflection is another package that provides similar functionalities to irregular-plurals. It includes methods for pluralizing and singularizing both regular and irregular nouns. Additionally, it supports other string transformations such as camelizing, underscoring, and humanizing, making it suitable for more complex text processing tasks.
Map of nouns to their irregular plural form
An irregular plural in this library is defined as a noun that cannot be made plural by applying these rules:
- If the noun ends in an "s", "x", "z", "ch" or "sh", add "es"
- If the noun ends in a "y" and is preceded by a consonant, drop the "y" and add "ies"
- If the noun ends in a "y" and is preceded by a vowel, add "s"
The list is just a JSON file and can be used anywhere.
$ npm install irregular-plurals
const irregularPlurals = require('irregular-plurals');
console.log(irregularPlurals.get('cactus'));
//=> 'cacti'
console.log(irregularPlurals);
/*
Map {
[addendum, 'addenda'],
[alga, 'algae'],
…
}
*/
MIT © Sindre Sorhus
FAQs
Map of nouns to their irregular plural form
The npm package irregular-plurals receives a total of 1,083,241 weekly downloads. As such, irregular-plurals popularity was classified as popular.
We found that irregular-plurals demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.